<template>
	<u-popup :show="isSnsShow" mode="bottom" :round="12">
		<view class="communityBox">

			<image class="communityBox_bg" :src="imgSrc+'/modal_joinVIP_header_bg.png'" mode="widthFix"></image>

			<view class="communityBox_hd">
				<image class="communityBox_hd_lf" :src="imgSrc+'/modal_joinVIP_header_left.png'" mode="widthFix">
				</image>
				<image class="communityBox_hd_rt" :src="imgSrc+'/modal_joinVIP_header_right.png'" mode="widthFix">
				</image>
			</view>

			<view class="communityHeard">
				<view class="communityHeard_szBox">
					<span class="communityHeard_szBoxTitle">当前所选城市：</span>
					<view class="communityHeard_shiqu"
						@click="goPatch(`/package/citySelection/index?isText=${isText}`)">
						<span>{{location.name ? location.name : '选择城市'}}</span>
						<image src="/static/img/bottomIcon.png"></image>
					</view>
				</view>
			</view>
			<view class="communityMain">
				<view v-for="(item,index) in unlockObj" :key="index" class="communityItems"
					@click.stop="unlock(item.title,item.priceId,item.communityId,item.hasDiscount)">
					<image mode="scaleToFill" class="communityItemBg" src="/static/img/itemTiao.png"></image>
					<span class="communityItemTj" v-if="item.isRecommend">推荐</span>
					<view class="communityItemLeftBox">
						<p>{{item.title}}</p>
						<p>{{item.describe}}</p>
					</view>
					<view class="communityItemRightBox">
						<p class="communityItemRightBoxPx">
							<span>{{item.discountPrice}}</span>
							<span>元/年</span>
						</p>
						<p class="communityItemRightBoxP">
							<span>原价：</span>
							<span>¥{{item.originalPrice}}</span>
						</p>
					</view>
				</view>
			</view>
			<view class="communityButtom" @click.stop="onUnlock">进入体验版</view>
			<view class="footer-mess">进入体验版可免费查看餐饮商机评估板块内容</view>
		</view>
	</u-popup>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		props: {
			referralsItem: {
				type: Object,
				default: {}
			},
			isSnsShow: {
				type: Boolean,
				default: true
			},
			unlockObj: {
				type: Array,
				default: []
			},
			isText: {
				type: Number,
				default: 2
			},
		},
		computed: {
			location() {
				return this.$store.state.location;
			},
			imgSrc() {
				return this.$store.state.imgSrc;
			},

		},
		methods: {
			unlock(title, priceId, communityId, hasDiscount) {
				this.$emit('unlock', title, priceId, communityId, hasDiscount);
			},
			onUnlock() {
				this.$emit('onUnlock');
			},

			goPatch(url) {
				uni.navigateTo({
					url
				})

			},
		}
	}
</script>

<style lang="scss" scoped>
	.communityBox {
		width: 750rpx;
		padding: 32rpx;
		box-sizing: border-box;
		position: relative;
		z-index: 1;

		&_bg {
			display: block;
			width: 100%;
			position: absolute;
			top: 0;
			left: 0;
			z-index: -1;
		}

		&_hd {
			position: relative;

			&_lf {
				display: block;
				width: 400rpx;
			}

			&_rt {
				display: block;
				width: 200rpx;
				position: absolute;
				bottom: 0;
				right: 0;
			}

		}
	}

	.welcomeBg {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: -1;
	}

	/deep/.u-popup__content {
		background-color: transparent !important;
	}

	.welcome {
		position: absolute;
		top: -40rpx;
		right: 30rpx;
		width: 196rpx;
		height: 124rpx;
	}

	.welcomeStar {
		position: absolute;
		top: 68rpx;
		right: 82rpx;
		width: 44rpx;
		height: 44rpx;
	}

	.communityMain {
		margin-top: 32rpx;
	}

	.communityItems {
		height: 162rpx;
		position: relative;
		border-radius: 24rpx;
		display: flex;
		box-sizing: border-box;

		&+.communityItems {
			margin-top: 32rpx;
		}

		.communityItemBg {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			z-index: -1;
		}

		&::after {
			content: '';
			display: block;
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			left: 0;
			background-color: rgba(0, 0, 0, 0.2);
			filter: blur(8px);
			z-index: -10;
		}
	}

	.communityHeard {
		z-index: 4;
	}

	.communityHeard_szBox {
		display: flex;
		align-items: center;
		margin-top: 32rpx;
	}

	.communityHeard_szBoxTitle {
		font-size: 28rpx;
		color: #333;
	}

	.communityHeard_shiqu {
		display: flex;
		align-items: center;
		background: #FFDA2D;
		opacity: 1;
		border-radius: 12rpx;
		padding: 0 16rpx 0 24rpx;

		span {
			font-size: 28rpx;
			font-weight: bold;
			line-height: 64rpx;
			color: #333;
		}

		image {
			width: 24rpx;
			height: 24rpx;
			margin-left: 4rpx;
		}
	}

	.communityItemTj {
		position: absolute;
		top: -10rpx;
		right: 32rpx;
		width: 64rpx;
		height: 38rpx;
		line-height: 38rpx;
		background: #FFDA2D;
		opacity: 1;
		border-radius: 10rpx;
		font-size: 24rpx;
		font-weight: bold;
		text-align: center;
	}

	.communityItemRightBoxPx {

		span {
			display: inline-block;
			font-family: DIN;
			font-weight: bold;
		}

		span:nth-child(1) {
			font-size: 48rpx;
			line-height: 56rpx;
			color: #FF471C;
		}

		span:nth-child(2) {
			font-size: 20rpx;
			line-height: 28rpx;
			color: #FF471C;
		}
	}

	.communityItemRightBoxP {
		margin-top: 8rpx;

		span {
			display: inline-block;
			font-size: 24rpx;
			font-weight: 400;
			line-height: 32rpx;
			color: #999;
		}

		span:nth-child(2) {
			text-decoration: line-through;
		}
	}

	.communityItemLeftBox {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		padding: 32rpx;

		p:nth-child(1) {
			font-size: 28rpx;
			font-weight: bold;
			line-height: 56rpx;
			color: #333;
		}

		p:nth-child(2) {
			margin-top: 8rpx;
			font-size: 24rpx;
			font-weight: 400;
			line-height: 32rpx;
			color: #999999;

		}
	}

	.communityItemRightBox {
		width: 240rpx;
		flex-shrink: 0;
		box-sizing: border-box;
		padding: 32rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		border-left: 1rpx #efefef dashed;
		text-align: center;
	}

	.communityButtom {
		background: #FFDA2D;
		font-weight: bold;
		border-radius: 24rpx;
		font-size: 28rpx;
		line-height: 88rpx;
		text-align: center;
		color: #333;
		margin: 32rpx 32rpx 0 32rpx;
	}

	.footer-mess {
		font-size: 24rpx;
		text-align: center;
		color: #333;
		margin-top: 24rpx;
	}
</style>
